<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">

        <ui:define name="content">
            <h:form styleClass="jsfcrud_list_form">
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <h:outputText escape="false" value="#{bundle.ListCustomerEntityEmpty}" rendered="#{customerEntityController.searchItems.rowCount == 0}"/>
                <h:panelGroup rendered="#{customerEntityController.searchItems.rowCount > 0}">
                   <h:dataTable value="#{customerEntityController.searchItems}" var="item" border="0" cellpadding="2" cellspacing="0" rowClasses="jsfcrud_odd_row,jsfcrud_even_row" rules="all" style="border:solid 1px">
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_companyName}"/>
                            </f:facet>
                            <h:outputText value="#{item.companyName}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_jobTitle}"/>
                            </f:facet>
                            <h:outputText value="#{item.jobTitle}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_customerAccount}"/>
                            </f:facet>
                            <h:outputText value="#{item.customerAccount}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_customerExecutive}"/>
                            </f:facet>
                            <h:outputText value="#{item.customerExecutive}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_name}"/>
                            </f:facet>
                            <h:outputText value="#{item.name}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_password}"/>
                            </f:facet>
                            <h:outputText value="#{item.password}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_firstName}"/>
                            </f:facet>
                            <h:outputText value="#{item.firstName}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_lastName}"/>
                            </f:facet>
                            <h:outputText value="#{item.lastName}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_title}"/>
                            </f:facet>
                            <h:outputText value="#{item.title}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_contact}"/>
                            </f:facet>
                            <h:outputText value="#{item.contact}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_id}"/>
                            </f:facet>
                            <h:outputText value="#{item.id}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_createdAt}"/>
                            </f:facet>
                            <h:outputText value="#{item.createdAt}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_createdBy}"/>
                            </f:facet>
                            <h:outputText value="#{item.createdBy}"/>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_lastModifiedAt}"/>
                            </f:facet>
                            <h:outputText value="#{item.lastModifiedAt}">
                                <f:convertDateTime pattern="MM/dd/yyyy" />
                            </h:outputText>
                        </h:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="#{bundle.ListCustomerEntityTitle_lastModifiedBy}"/>
                            </f:facet>
                            <h:outputText value="#{item.lastModifiedBy}"/>

                            <h:outputText value= "Archived" rendered="#{item.archived==true}"/>
                            <h:outputText value= "Active" rendered="#{item.archived==false}"/>

                        </h:column>
                         <p:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <p:commandButton image="ui-icon ui-icon-search" update="display" oncomplete="customerDialog.show()">
                                    <f:setPropertyActionListener value="#{item}"  
                                                                 target="#{customerEntityController.customer}" /> 
                                </p:commandButton>
                            </p:column>
                       
                        <p:column>
                            <p:menuButton value="Options">    

                                <p:menuitem value=" Edit" ajax="false" icon="ui-icon ui-icon-disk" rendered="#{loginBacking.editCustomer}"
                                            action="#{customerEntityController.prepareEdit}"/>
                                <p:menuitem value=" Delete" ajax="false" rendered="#{item.archived==false and loginBacking.deleteCustomer}" icon="ui-icon ui-icon-close"
                                            action="#{customerEntityController.Destroy}"/>
                                <p:menuitem value=" Activate" ajax="false" rendered="#{item.archived==true and loginBacking.deleteCustomer}" icon="ui-icon ui-icon-open"
                                            action="#{customerEntityController.Activate}"/> 
                            </p:menuButton>   
                        </p:column>
                        <h:column>
                            <f:facet name="header">
                                <h:outputText value="&nbsp;"/>
                            </f:facet>
                            <h:commandLink action="#{customerEntityController.prepareSearchView}" value="#{bundle.ListCustomerEntityViewLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{customerEntityController.prepareEdit}" value="#{bundle.ListCustomerEntityEditLink}"/>
                            <h:outputText value=" "/>
                            <h:commandLink action="#{customerEntityController.destroy}" value="#{bundle.ListCustomerEntityDestroyLink}" rendered="#{item.archived==false}"/>
                            <h:commandLink action="#{customerEntityController.activate}" value="#{bundle.ListCustomerEntityActivateLink}" rendered="#{item.archived==true}"/>
                        </h:column>
                    </h:dataTable>
                </h:panelGroup>
                <br />
                <br />
                <br />
                <h:commandLink value="#{bundle.ListCustomerEntityIndexLink}" action="/index" immediate="true" />
            </h:form>
        </ui:define>
    </ui:composition>

</html>







<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <ui:composition template="/template/DefaultTemplate.xhtml">

        <ui:define name="content">

            <h:form>
                <p:commandButton action="#{customerEntityController.prepareCreate}" rendered="#{loginBacking.addCustomer}" ajax="false" value="Create New Customer"/>
            </h:form>
            <br/>

                <h:form prependId="false">

                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                    </h:panelGroup>
                    <h:outputText escape="false" value="#{bundle.ListCustomerEntityEmpty}" rendered="#{customerEntityController.searchItems.rowCount == 0}"/>

                    <p:panel toggleable="true" id="customerList" header="Customers" rendered="#{customerEntityController.searchItems.rowCount > 0}">
                        <p:dataTable value="#{customerEntityController.searchItems}" 
                                     var="item"  
                                     style="table-layout:fixed" paginator="true" rows="10"  
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                                     rowsPerPageTemplate="5,10,15">  
                            <p:column filterBy="#{item.id}">
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListCustomerEntityTitle_id}"/>
                                </f:facet>
                                <h:outputText value="#{item.id}"/>
                            </p:column>
                            <p:column filterBy="#{item.name}">
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListCustomerEntityTitle_name}"/>
                                </f:facet>
                                <h:outputText value="#{item.name}"/>
                            </p:column>
                            <p:column filterBy="#{item.companyName}">
                                <f:facet name="header">
                                    <h:outputText value="Company"/>
                                </f:facet>
                                <h:outputText value="#{item.companyName}"/>
                            </p:column>


                            <p:column filterBy="#{item.customerExecutive.firstName}">
                                <f:facet name="header">
                                    <h:outputText value="Customer Executive"/>
                                </f:facet>
                                <h:outputText value="#{item.customerExecutive.firstName}"/>
                            </p:column>
                            <p:column filterBy="#{item.customerType}">
                                <f:facet name="header">
                                    <h:outputText value="Customer Type"/>
                                </f:facet>
                                <h:outputText value="#{item.customerType}"/>
                            </p:column>
                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListSalesLeadEntityTitle_isArchived}"/>
                                </f:facet>
                                <h:outputText value= "Archived" rendered="#{item.archived==true}"/>
                                <h:outputText value= "Active" rendered="#{item.archived==false}"/>
                            </p:column>



                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <p:commandButton image="ui-icon ui-icon-search" update="display" oncomplete="customerDialog.show()">
                                    <f:setPropertyActionListener value="#{item}"  
                                                                 target="#{customerEntityController.customer}" /> 
                                </p:commandButton>
                            </p:column>

                            <p:column rendered="#{loginBacking.editCustomer or loginBacking.deleteCustomer}">  
                                <p:menuButton value="Options">       
                                    <p:menuitem value=" Edit" ajax="false" icon="ui-icon ui-icon-disk" 
                                                action="#{customerEntityController.prepareEdit}" rendered="#{loginBacking.editCustomer}"/>
                                    <p:menuitem value=" Delete" ajax="false" rendered="#{item.archived==false and loginBacking.deleteCustomer}" icon="ui-icon ui-icon-close"
                                                action="#{customerEntityController.destroy}"/>        
                                </p:menuButton>    
                            </p:column>

                        </p:dataTable>

                        <p:dialog header="Customer Detail" widgetVar="customerDialog" resizable="false"  
                                  width="325" showEffect="explode" hideEffect="explode">  

                            <h:panelGrid id="display" columns="2" cellpadding="4">  

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_companyName}"/>
                                <h:outputText value="#{customerEntityController.customer.companyName}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_jobTitle}"/>
                                <h:outputText value="#{customerEntityController.customer.jobTitle}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_customerAccount}"/>
                                <h:outputText value="#{customerEntityController.customer.customerAccount}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_customerExecutive}"/>
                                <h:outputText value="#{customerEntityController.customer.customerExecutive.firstName}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_name}"/>
                                <h:outputText value="#{customerEntityController.customer.name}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_password}"/>
                                <h:outputText value="#{customerEntityController.customer.password}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_firstName}"/>
                                <h:outputText value="#{customerEntityController.customer.firstName}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_lastName}"/>
                                <h:outputText value="#{customerEntityController.customer.lastName}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_title}"/>
                                <h:outputText value="#{customerEntityController.customer.title}"/>

                                <h:outputText value="Contact Number: "/>
                                <h:outputText value="#{customerEntityController.customer.contact.contactNumber}"/>

                                <h:outputText value="Customer Type: "/>
                                <h:outputText value="#{customerEntityController.customer.customerType}"/>

                                <h:outputText value="Email"/>
                                <h:outputText value="#{customerEntityController.customer.contact.email}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_id}"/>
                                <h:outputText value="#{customerEntityController.customer.id}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_createdAt}"/>
                                <h:outputText value="#{customerEntityController.customer.createdAt}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_createdBy}"/>
                                <h:outputText value="#{customerEntityController.customer.createdBy.firstName}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_lastModifiedAt}"/>
                                <h:outputText value="#{customerEntityController.customer.lastModifiedAt}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_lastModifiedBy}"/>
                                <h:outputText value="#{customerEntityController.customer.lastModifiedBy.firstName}"/>

                                <h:outputText value="#{bundle.ListCustomerEntityTitle_isArchived}"/>
                                <h:outputText value= "Archived" rendered="#{customerEntityController.customer.archived==true}"/>
                                <h:outputText value= "Active" rendered="#{customerEntityController.customer.archived==false}"/>
                            </h:panelGrid>  
                        </p:dialog>  
                    </p:panel>
                </h:form>
        </ui:define>
    </ui:composition>

</html>

